package com.exam.pojo.domain;

import com.exam.utils.CollUtils;
import lombok.Data;
import org.springframework.data.annotation.Id;
import org.springframework.data.mongodb.core.mapping.Document;
import org.springframework.data.mongodb.core.mapping.Field;

import java.util.Arrays;
import java.util.List;


@Data
@Document(collection = "user")
//用户表
public class User {

    @Id
    private String id;
    private String nickname;
    @Field("head_img")
    private String headImg;
    private String token;
    private String version;

    //答题数量
    @Field("answer_nums")
    private Integer answerNums = 0;
    //考试次数
    @Field("exam_nums")
    private Integer examNums = 0;
    @Field("exam_rates")
    private Double examRates = 0.0;
    //正确数量
    @Field("correct_nums")
    private Integer correctNums = 0;
    //错误数量
    @Field("error_nums")
    private Integer errorNums = 0;
    @Field("finish_question_ids")
    private List<Long> finishQuestionIds = CollUtils.emptyList();
    @Field("error_question_ids")
    private List<Long> errorQuestionIds = CollUtils.emptyList();
    @Field("collect_question_ids")
    private List<Long> collectQuestionIds = CollUtils.emptyList();
    @Field("continent_id")
    private Long continentId;
    @Field("category_ids")
    private List<Long> categoryIds = Arrays.asList(
            2042976496804429832L,2042976496942841863L,2042976496955424772L,
            2042976496963813379L,2042976496972201989L,2042976496980590597L,
            2042976496988979208L,2042976496997367815L,2042976497001562115L);



    public static User defaultUser(){
        User user = new User();
        user.setNickname("anonyamousnickname");
        user.setHeadImg("105");
        return  user;
    }
}
